错误票据
题目 错误票据
思路分析
代码实现
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int st[N];
int main()
{
int n;
cin>>n;
int start=N,len=0;
while(n--){
int x;
while(cin>>x){
st[x]++;
start=min(start,x);
len++;
}
}
int Br=0,Re=0;
for(int i=start;i<start+len;i++){
if(st[i]==0)
Br=i;
if(st[i]>1)
Re=i;
}
cout<<Br<<" "<<Re;
return 0;
}
同类题型
视频讲解
⬅️ 递增三元组 🏠 00-刷题理模型 ➡️ (70分)外卖店优先级
💬 评论